@extends('template.adminpage')
@section('content')
 
<ol class="breadcrumb">
  <li class="active">ID Card type</li>
</ol>

<div class="container-black">
	<br>
  <label><u>Pencarian</u></label>
  
	<form action="{{URL::to('/idcard/idcardtypes')}}" method="POST">
        <div class="input-group" >
           <label class="pull-left" style="margin-top:5px">Type (Jenis)  </label>
           <input type="text" class="form-control pull-left" name="filter" style="width:250px;height:30px; margin-left:10px" value="{{Session::get('filter')}}">
           <span class="input-group-btn pull-left">
             <button class="btn btn-dark btn-sm" type="submit" style="width:100px;height:30px"><span class="fa fa-search"></span> Tampilkan</button>
           </span>
        </div><!-- /input-group -->
    </form>
    <br>
     <form action="{{URL::to('/idcard/idcardtype/deleteidcardtype')}}"  method="post" >
    <p><a data-toggle="modal" data-target="#addidcardtype"><button class="btn btn-sm btn-dark" style="height:30px" ><span class="fa fa-plus"></span> Tambah</button></a> <button style="height:30px" class="btn btn-sm btn-dark" type="submit" ><span class="fa  fa-times"></span> Hapus</button></p>
  	 <?php
        $limit = 10;
        if(Input::get('page')==0 OR Input::get('page')==1){ 
         $no = 1;
        }
        else{
         $no = ((Input::get('page')-1)*$limit)+1;
        } ?>
     <table class="table table-bordered table-hover">
      <thead>
        <tr>
          <th><input type="checkbox" name="checkall" id="terserah" onclick="check_all('terserah', {{$no}})" ></input></th>
          <th>No</th>
          <th>Type (Jenis)</th>
          <th>Aksi</th>
        </tr>
      </thead>
      <tbody>
      	
        @foreach($idcardtype as $type)
        <tr>
          <td><input type="checkbox" name="{{$type->idcard_type_id}}" value="1" id="terserah_{{$no}}" ></input></td>
          <td>{{$no}}</td>
          <td>{{$type->idcard_type_name}}</td>
          <td><a data-toggle="modal" data-target="#{{$type->idcard_type_id}}"><button class="btn btn-xs btn-dark"><span class="fa fa-edit"></span> Ubah</button></a></td>
        </tr>
        <?php $no++; ?>
        @endforeach
      </tbody>
    </table>
  </form>
    <div class="text-right"><?php echo $idcardtype->links(); ?></div>


        

               <div class="modal fade" id="addidcardtype" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Tambah data jenis ID Card  </label></h4>
                    </div>
                    <br>
                    <div align="left">
                              {{Form::open(array(
                                    'url' => '/idcard/idcardtype/addidcardtype',
                                    'method' => 'POST'
                                  ))}}
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-8 col-md-offset-1">

                                      <div class="row">
                                      <div class="col-lg-4">
                                      <label>Jenis ID Card <font color="red"> *</font></label>
                                      </div>
                                      <div class="col-lg-4">
                                        <input type="text"  class="form-control"  name="idcard_type_name" placeholder="Jenis ID Card"style="width:200px;height:30px" value="" required/></input>{{$errors->first('jenis_idcard')}}
                                      </div>
                                      </div>
                                      <br>
                                      <font color="red" class="text-left">* Data tidak boleh kosong</font>

                              </div>
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>

              @foreach($idcardtype as $type)
              <div class="modal fade" id="{{$type->idcard_type_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">Ubah data jenis ID Card  </label></h4>
                    </div>
                    <div align="left">
                              {{Form::open(array(
                                    'url' => '/idcard/idcardtype/editidcardtype/'.$type->idcard_type_id,
                                    'method' => 'POST'
                                  ))}}
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-8 col-md-offset-1">

                                      <div class="row">
                                      <div class="col-lg-4">
                                      <label>Jenis ID Card <font color="red"> *</font></label>
                                      </div>
                                      <div class="col-lg-4">
                                        <input type="text"  class="form-control"  name="idcard_type_name" placeholder="Jenis ID Card"style="width:200px;height:30px" value="{{$type->idcard_type_name}}" /></input>{{$errors->first('jenis_idcard')}}
                                      </div>
                                      </div>
                                      <br>
                                      <font color="red" class="text-left">* Data tidak boleh kosong</font>

                              </div>
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button type="submit" class="btn btn-sm btn-dark"><span class="fa fa-floppy-o"></span> Simpan</button>{{Form::close()}} <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Batal</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach

</div>


@stop
@stop